home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / Panel.java < prev    next >
Text File  |  1998-09-22  |  2KB  |  83 lines

  1. /*
  2.  * @(#)Panel.java    1.20 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14. package java.awt;
  15.  
  16. import java.awt.peer.PanelPeer;
  17.  
  18. /**
  19.  * <code>Panel</code> is the simplest container class. A panel   
  20.  * provides space in which an application can attach any other 
  21.  * component, including other panels. 
  22.  * <p>
  23.  * The default layout manager for a panel is the 
  24.  * <code>FlowLayout</code> layout manager.
  25.  *
  26.  * @version     1.20, 07/01/98
  27.  * @author     Sami Shaio
  28.  * @see     java.awt.FlowLayout
  29.  * @since   JDK1.0
  30.  */
  31. public class Panel extends Container {
  32.     final static LayoutManager panelLayout = new FlowLayout();
  33.  
  34.     private static final String base = "panel";
  35.     private static int nameCounter = 0;
  36.  
  37.     /*
  38.      * JDK 1.1 serialVersionUID 
  39.      */
  40.      private static final long serialVersionUID = -2728009084054400034L;
  41.  
  42.     /**
  43.      * Creates a new panel using the default layout manager. 
  44.      * The default layout manager for all panels is the 
  45.      * <code>FlowLayout</code> class.
  46.      * @since       JDK1.0
  47.      */
  48.     public Panel() {
  49.     this(panelLayout);
  50.     }
  51.  
  52.     /**
  53.      * Creates a new panel with the specified layout manager.
  54.      * @param layout the layout manager for this panel.
  55.      * @since JDK1.1
  56.      */
  57.     public Panel(LayoutManager layout) {
  58.     setLayout(layout);
  59.     }
  60.  
  61.     /**
  62.      * Construct a name for this component.  Called by getName() when the
  63.      * name is null.
  64.      */
  65.     String constructComponentName() {
  66.         return base + nameCounter++;
  67.     }
  68.  
  69.     /**
  70.      * Creates the Panel's peer.  The peer allows you to modify the
  71.      * appearance of the panel without changing its functionality.
  72.      */
  73.  
  74.     public void addNotify() {
  75.         synchronized (getTreeLock()) {
  76.         if (peer == null)
  77.             peer = getToolkit().createPanel(this);
  78.         super.addNotify();
  79.         }
  80.     }
  81.  
  82. }
  83.